#ifndef BSP_FLASH_H
#define BSP_FLASH_H

#include "stm32f10x.h"


#define STM32_FLASH_SIZE 128 	 		          
#define STM32_FLASH_WREN 1                  
#define STM32_FLASH_BASE 			0x08000000 	  


#define	FLASH_SAVE_STAR_ADDRESS		0x08019000	

u16  STMFLASH_ReadHalfWord(u32 faddr);		  
void STMFLASH_Write(u32 WriteAddr,u16 *pBuffer,u16 NumToWrite);		
void STMFLASH_Read(u32 ReadAddr,u16 *pBuffer,u16 NumToRead);   		


#define FLASH_BASE_ADDR	0x08000000			

#define	FLASH_SIZE		(128*1024)		



#define SECTOR_MASK			0xFFFFF400

#define FLASH_IS_EQU		0   
#define FLASH_REQ_WRITE		1	
#define FLASH_REQ_ERASE		2	
#define FLASH_PARAM_ERR		3	

uint8_t bsp_ReadCpuFlash(uint32_t _ulFlashAddr, uint8_t *_ucpDst, uint32_t _ulSize);
uint8_t bsp_WriteCpuFlash(uint32_t _ulFlashAddr, uint8_t *_ucpSrc, uint32_t _ulSize);
uint8_t bsp_CmpCpuFlash(uint32_t _ulFlashAddr, uint8_t *_ucpBuf, uint32_t _ulSize);


#endif
